package org.seckill.enums;

/**
 * Created by chenhui479 on 16/11/20.
 */
public enum  SeckillStatEnum {

    SUCCESS(1,"秒杀成功"),
    END(0,"秒杀结束"),
    REPEAT_KILL(-1,"重复秒杀"),
    INNER_ERROR(-2,"系统异常"),
    DATA_REWRITE(-3,"数据篡改");


    private  int sate;
    private String stateInfo;

    SeckillStatEnum(int sate, String stateInfo) {
        this.sate = sate;
        this.stateInfo = stateInfo;
    }

    public int getSate() {
        return sate;
    }

    public void setSate(int sate) {
        this.sate = sate;
    }

    public String getStateInfo() {
        return stateInfo;
    }

    public void setStateInfo(String stateInfo) {
        this.stateInfo = stateInfo;
    }


    public  static  SeckillStatEnum stateOf(int index){
        for(SeckillStatEnum statEnum : values()){
            if(statEnum.getSate() == index){
                return statEnum;
            }
        }
        return null;
    }
}
